package com.twu.biblioteca;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * User: Thoughtworker
 * Date: 7/9/13
 * Time: 3:52 PM
 * To change this template use File | Settings | File Templates.
 */
public class Menu {
    public void welcomeMessage(){
        System.out.println("\nWelcome to the library\n");
    }

    public void printMenuOptions(){
        System.out.println("1. View List of Books");
        System.out.println("2. Reserve a Book");
        System.out.println("3. Check membership details");
        System.out.println("4. View List of Movies");
        System.out.println("5. Exit");

    }

    public String selectMenuOption(){
        String userInput;
        while (true){
            System.out.print("\nSelect a Menu Option by number(1-5): ") ;
            userInput= getUserInput();
            if (userInput.equals("1") || userInput.equals("2") || userInput.equals("3")  || userInput.equals("4") || userInput.equals("5"))
                break;
            System.out.print("Select a valid option!\n");
        }
        return userInput;
    }

    public void printSeeLibrarian(){
        System.out.println("\nPlease Talk to a Librarian. Thank you!\n");
    }

    public String enterBookTitle(Library library) {
        library.printList(library.getBookList());
        System.out.print("Please enter the title of the book: ");
        return getUserInput();

    }

    static public String getUserInput(){
        Scanner input = new Scanner(System.in);
        return input.next();
    }
}
